<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3D健身人物动画</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #1a2a6c, #b21f1f, #1a2a6c);
            color: white;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 20px;
            overflow-x: hidden;
        }

        header {
            text-align: center;
            padding: 30px 0;
            width: 100%;
        }

        h1 {
            font-size: 3.5rem;
            margin-bottom: 10px;
            text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
            background: linear-gradient(to right, #ff7e5f, #feb47b);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }

        .subtitle {
            font-size: 1.4rem;
            opacity: 0.9;
            max-width: 800px;
            margin: 0 auto;
            line-height: 1.6;
        }

        .container {
            display: flex;
            justify-content: center;
            align-items: center;
            flex-wrap: wrap;
            gap: 40px;
            max-width: 1400px;
            margin: 20px auto;
        }

        .animation-container {
            width: 500px;
            height: 600px;
            background: rgba(0, 0, 0, 0.3);
            border-radius: 20px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
            position: relative;
            overflow: hidden;
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .animation-title {
            position: absolute;
            top: 20px;
            left: 0;
            right: 0;
            text-align: center;
            font-size: 2.2rem;
            font-weight: bold;
            z-index: 10;
            color: #ffcc00;
            text-shadow: 0 0 8px rgba(0, 0, 0, 0.7);
        }

        .gym-floor {
            position: absolute;
            bottom: 0;
            width: 100%;
            height: 30%;
            background: linear-gradient(to top, #333, #222);
            border-top: 2px solid #444;
        }

        .gym-grid {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-image:
                    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
            background-size: 50px 50px;
            z-index: -1;
        }

        /* 3D人物样式 */
        .character {
            position: absolute;
            bottom: 30%;
            left: 50%;
            transform: translateX(-50%);
            width: 120px;
            height: 300px;
            perspective: 1000px;
        }

        .head {
            position: absolute;
            top: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 60px;
            height: 70px;
            background: #f1c27d;
            border-radius: 50%;
            z-index: 10;
            box-shadow: 0 5px 15px rgba(0,0,0,0.3);
        }

        .body {
            position: absolute;
            top: 60px;
            left: 50%;
            transform: translateX(-50%);
            width: 80px;
            height: 130px;
            background: #3498db;
            border-radius: 40px 40px 10px 10px;
            z-index: 5;
        }

        .arm {
            position: absolute;
            width: 25px;
            background: #f1c27d;
            border-radius: 15px;
        }

        .left-arm {
            top: 70px;
            left: 20px;
            height: 100px;
            transform-origin: top center;
        }

        .right-arm {
            top: 70px;
            right: 20px;
            height: 100px;
            transform-origin: top center;
        }

        .leg {
            position: absolute;
            width: 30px;
            background: #2980b9;
            border-radius: 10px 10px 5px 5px;
        }

        .left-leg {
            top: 180px;
            left: 35px;
            height: 120px;
            transform-origin: top center;
        }

        .right-leg {
            top: 180px;
            right: 35px;
            height: 120px;
            transform-origin: top center;
        }

        /* 杠铃 */
        .barbell {
            position: absolute;
            top: 150px;
            left: 50%;
            transform: translateX(-50%);
            width: 180px;
            height: 8px;
            background: linear-gradient(to right, #aaa, #ddd, #aaa);
            border-radius: 4px;
            z-index: 4;
            box-shadow: 0 0 10px rgba(0,0,0,0.5);
        }

        .weight {
            position: absolute;
            width: 20px;
            height: 60px;
            background: linear-gradient(to right, #555, #333, #555);
            border-radius: 3px;
        }

        .left-weight {
            left: -25px;
        }

        .right-weight {
            right: -25px;
        }

        /* 控制面板 */
        .controls {
            background: rgba(0, 0, 0, 0.4);
            border-radius: 15px;
            padding: 25px;
            max-width: 500px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .control-group {
            margin-bottom: 25px;
        }

        h2 {
            font-size: 1.8rem;
            margin-bottom: 20px;
            color: #ffcc00;
        }

        .slider-container {
            margin-bottom: 15px;
        }

        label {
            display: block;
            margin-bottom: 8px;
            font-size: 1.1rem;
        }

        input[type="range"] {
            width: 100%;
            height: 10px;
            border-radius: 5px;
            background: #555;
            outline: none;
        }

        .btn-group {
            display: flex;
            gap: 15px;
            margin-top: 25px;
        }

        button {
            flex: 1;
            padding: 15px;
            border: none;
            border-radius: 10px;
            background: linear-gradient(to right, #ff7e5f, #feb47b);
            color: white;
            font-size: 1.1rem;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        }

        button:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
        }

        button:active {
            transform: translateY(1px);
        }

        .info-panel {
            background: rgba(0, 0, 0, 0.4);
            border-radius: 15px;
            padding: 25px;
            margin-top: 30px;
            max-width: 1000px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .info-content {
            display: flex;
            gap: 30px;
            flex-wrap: wrap;
        }

        .exercise-info {
            flex: 1;
            min-width: 300px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 15px;
            padding: 20px;
        }

        h3 {
            font-size: 1.5rem;
            color: #ffcc00;
            margin-bottom: 15px;
        }

        ul {
            padding-left: 25px;
        }

        li {
            margin-bottom: 10px;
            line-height: 1.6;
        }

        .benefits {
            margin-top: 10px;
            font-style: italic;
        }

        @media (max-width: 1100px) {
            .container {
                flex-direction: column;
            }

            .animation-container {
                width: 90vw;
                height: 500px;
            }
        }

        @media (max-width: 600px) {
            h1 {
                font-size: 2.5rem;
            }

            .animation-container {
                height: 400px;
            }

            .character {
                transform: translateX(-50%) scale(0.8);
            }
        }
    </style>
</head>
<body>
<header>
    <h1>3D健身人物动画</h1>
    <p class="subtitle">观察逼真的3D人物模型执行深蹲和卧推的标准动作，了解健身动作的正确姿势和肌肉活动</p>
</header>

<div class="container">
    <div class="animation-container">
        <div class="gym-grid"></div>
        <div class="gym-floor"></div>
        <div class="animation-title">深蹲动作演示</div>

        <div class="character" id="squat-character">
            <div class="head"></div>
            <div class="body"></div>
            <div class="arm left-arm"></div>
            <div class="arm right-arm"></div>
            <div class="leg left-leg"></div>
            <div class="leg right-leg"></div>
        </div>
    </div>

    <div class="animation-container">
        <div class="gym-grid"></div>
        <div class="gym-floor"></div>
        <div class="animation-title">卧推动作演示</div>

        <div class="character" id="benchpress-character">
            <div class="head"></div>
            <div class="body"></div>
            <div class="arm left-arm"></div>
            <div class="arm right-arm"></div>
            <div class="leg left-leg"></div>
            <div class="leg right-leg"></div>
            <div class="barbell">
                <div class="weight left-weight"></div>
                <div class="weight right-weight"></div>
            </div>
        </div>
    </div>
</div>

<div class="controls">
    <h2>动画控制面板</h2>

    <div class="control-group">
        <div class="slider-container">
            <label for="speed">动画速度: <span id="speed-value">正常</span></label>
            <input type="range" id="speed" min="0.5" max="2" step="0.1" value="1">
        </div>

        <div class="slider-container">
            <label for="perspective">3D透视: <span id="perspective-value">中等</span></label>
            <input type="range" id="perspective" min="1" max="10" step="1" value="5">
        </div>
    </div>

    <div class="btn-group">
        <button id="play-btn">播放动画</button>
        <button id="pause-btn">暂停动画</button>
        <button id="reset-btn">重置视图</button>
    </div>
</div>

<div class="info-panel">
    <div class="info-content">
        <div class="exercise-info">
            <h3>深蹲动作要点</h3>
            <ul>
                <li>双脚与肩同宽，脚尖稍微外展</li>
                <li>保持背部挺直，核心收紧</li>
                <li>下蹲时臀部向后移动，膝盖不超过脚尖</li>
                <li>蹲至大腿与地面平行</li>
                <li>上升时脚跟发力，臀部前推</li>
                <li>保持头部和胸部抬起</li>
            </ul>
            <p class="benefits">主要锻炼肌群：股四头肌、臀大肌、腘绳肌</p>
        </div>

        <div class="exercise-info">
            <h3>卧推动作要点</h3>
            <ul>
                <li>平躺于卧推凳，双脚稳固踩地</li>
                <li>双手略宽于肩握住杠铃</li>
                <li>下放杠铃至胸部中下部</li>
                <li>肘部与身体呈45度角</li>
                <li>推起杠铃至手臂伸直但不锁死</li>
                <li>保持肩胛骨收紧</li>
            </ul>
            <p class="benefits">主要锻炼肌群：胸大肌、三角肌前束、肱三头肌</p>
        </div>
    </div>
</div>

<script>
    document.addEventListener('DOMContentLoaded', function() {
        // 获取DOM元素
        const squatCharacter = document.getElementById('squat-character');
        const benchCharacter = document.getElementById('benchpress-character');
        const squatBody = squatCharacter.querySelector('.body');
        const squatLeftLeg = squatCharacter.querySelector('.left-leg');
        const squatRightLeg = squatCharacter.querySelector('.right-leg');
        const benchBody = benchCharacter.querySelector('.body');
        const benchLeftArm = benchCharacter.querySelector('.left-arm');
        const benchRightArm = benchCharacter.querySelector('.right-arm');
        const barbell = benchCharacter.querySelector('.barbell');

        // 控制面板元素
        const speedSlider = document.getElementById('speed');
        const perspectiveSlider = document.getElementById('perspective');
        const speedValue = document.getElementById('speed-value');
        const perspectiveValue = document.getElementById('perspective-value');
        const playBtn = document.getElementById('play-btn');
        const pauseBtn = document.getElementById('pause-btn');
        const resetBtn = document.getElementById('reset-btn');

        // 动画状态
        let animationSpeed = 1;
        let isPlaying = true;
        let perspective = 5;

        // 更新速度显示
        speedSlider.addEventListener('input', function() {
            animationSpeed = parseFloat(this.value);
            speedValue.textContent =
                animationSpeed === 0.5 ? '慢速' :
                    animationSpeed === 1 ? '正常' :
                        animationSpeed === 2 ? '快速' :
                            animationSpeed.toFixed(1) + 'x';
        });

        // 更新透视效果
        perspectiveSlider.addEventListener('input', function() {
            perspective = parseInt(this.value);
            perspectiveValue.textContent =
                perspective <= 3 ? '弱' :
                    perspective <= 7 ? '中等' : '强';

            document.querySelectorAll('.character').forEach(char => {
                char.style.perspective = (perspective * 200) + 'px';
            });
        });

        // 按钮事件
        playBtn.addEventListener('click', () => isPlaying = true);
        pauseBtn.addEventListener('click', () => isPlaying = false);
        resetBtn.addEventListener('click', () => {
            speedSlider.value = 1;
            perspectiveSlider.value = 5;
            animationSpeed = 1;
            perspective = 5;
            speedValue.textContent = '正常';
            perspectiveValue.textContent = '中等';

            document.querySelectorAll('.character').forEach(char => {
                char.style.perspective = '1000px';
            });
        });

        // 初始化透视效果
        document.querySelectorAll('.character').forEach(char => {
            char.style.perspective = '1000px';
        });

        // 动画循环
        function animate() {
            if (!isPlaying) {
                requestAnimationFrame(animate);
                return;
            }

            const now = Date.now();
            const squatTime = now * 0.001 * animationSpeed;
            const benchTime = now * 0.001 * animationSpeed;

            // 深蹲动画
            const squatPhase = Math.sin(squatTime);
            const legAngle = 30 + Math.abs(squatPhase) * 45;
            const bodyPosition = Math.max(0, squatPhase * 30);

            squatLeftLeg.style.transform = `rotateZ(${-legAngle}deg)`;
            squatRightLeg.style.transform = `rotateZ(${legAngle}deg)`;
            squatBody.style.transform = `translateX(-50%) translateY(${bodyPosition}px)`;

            // 卧推动画
            const benchPhase = Math.sin(benchTime);
            const armAngle = 30 + Math.abs(benchPhase) * 50;
            const barbellPosition = Math.max(0, benchPhase * 30);

            benchLeftArm.style.transform = `rotateZ(${-armAngle}deg)`;
            benchRightArm.style.transform = `rotateZ(${armAngle}deg)`;
            barbell.style.top = `${150 + barbellPosition}px`;

            // 添加3D旋转效果
            squatCharacter.style.transform = `translateX(-50%) rotateY(${Math.sin(squatTime * 0.5) * perspective}deg)`;
            benchCharacter.style.transform = `translateX(-50%) rotateY(${Math.cos(benchTime * 0.5) * perspective}deg)`;

            requestAnimationFrame(animate);
        }

        animate();
    });
</script>
</body>
</html>